﻿using System;
using System.Windows;
using System.Windows.Browser;
using System.Windows.Controls;

namespace Kurax.BoardGames.Client.Views {
    public partial class Login {
        private void Button_Click(object sender, RoutedEventArgs e) {
            if(Application.Current.Host.Source == null)
                return;
            var button = (Button)sender;
            button.IsEnabled = false;
            var returnTo = (new Uri(Application.Current.Host.Source, "/")).OriginalString;
            var uri = new Uri("https://www.google.com/accounts/o8/ud?openid.ns=http://specs.openid.net/auth/2.0&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.ns.ext1=http://openid.net/srv/ax/1.0&openid.ext1.mode=fetch_request&openid.ext1.required=email&openid.ext1.type.email=http://axschema.org/contact/email&openid.mode=checkid_setup&openid.return_to=" + returnTo);
            HtmlPage.Window.Navigate(uri);
        }

        public Login() {
            this.InitializeComponent();
        }
    }
}
